<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 引入vue3 js文件 -->
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>

<body>
    <div id="app">
        <p>{{count}}</p>
        <p><button @click="addCount">add+1</button></p>
    </div>

</body>

</html>

<script>
    //app为根实例对象 

    // 选项式api
    const app = Vue.createApp({
        data() {
            return {
                count: 0
            }
        },
        // methods 选项表示一系列方法,该方法直接绑定在app 实例上的,可以直接调用
        methods: {
            addCount: function () {
                console.log('你点我了');
                // this 为代理对象, data(){return{}} 该函数返回值中的代理对象
                console.log(this);
                this.count++
            }
        }
    })

    app.mount('#app')

    console.log(app);



</script>